Homework: https://work.caltech.edu/homework/hw3.pdf
Answers:
Answer key: https://work.caltech.edu/homework/hw3_sol.pdf
In [2]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from IPython.display import display
from numpy.linalg import inv
In [ ]:
# probability >= 2 * M * e^(-2 * epsilon^2 * N)
# log (2 * M / probability) <= 2 * epsilon^2 * N
# N >= log (2 * M / probability) / 2 * epsilon^2
In [7]:
probability = 0.03
epsilon = 0.05
M = 1
N = np.log (2 * M / probability) / (2 * epsilon ** 2)
print "Answer 1: {}({})".format(np.ceil(N), N)
In [8]:
probability = 0.03
epsilon = 0.05
M = 10
N = np.log (2 * M / probability) / (2 * epsilon ** 2)
print "Answer 2: {}({})".format(np.ceil(N), N)
In [9]:
probability = 0.03
epsilon = 0.05
M = 100
N = np.log (2 * M / probability) / (2 * epsilon ** 2)
print "Answer 3: {}({})".format(np.ceil(N), N)
In [ ]: